﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using HWmanagementDB;

namespace HWmanagementServer
{
    [DataContract]
    public class ResultModel
    {
        [DataMember]
        public int id;
        [DataMember]
        public int homeworkid;
        [DataMember]
        public string userid;
        [DataMember]
        public int grade;
        [DataMember]
        public string comment;

        public static RESULT toDBTable(ResultModel rm)
        {
            return new RESULT() { HOMEWORKID = rm.homeworkid, USERID = rm.userid, GRADE = rm.grade, COMMENT = rm.comment, ID=rm.id };
        }

        public static ResultModel fromDBTable(RESULT r)
        {
            return new ResultModel() { homeworkid = r.HOMEWORKID, userid = r.USERID, grade = r.GRADE, comment = r.COMMENT, id=r.ID };
        }

    }
}
